<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="keywords" content="多谱音乐，音乐，曲谱播放器，五线谱，吉他谱，六线谱，简谱，四线谱，钢琴谱，小提琴谱，二胡谱，手风琴谱，扒谱，谱单，收藏，分享音乐，音乐互动，音乐社交，官网，dscore.cn">
    <meta name="description" content="多谱音乐是一款专注于发现与分享乐谱和音乐的产品，依托专业音乐人、DJ、好友推荐及社交功能，为用户打造全新的音乐生活。">

    <title>多谱音乐  --  中国最全最好用的音乐钢琴谱吉他谱尤克里里谱平台</title>
    <link rel="stylesheet" href="__STATIC__/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="__CSS__/common.css">
    <link rel="icon" href="__PUBLIC__/favicon.ico">
    <!--[if lt IE 9]>
    <script type="text/javascript" src="__STATIC__/jquery-1.10.2.min.js"></script>
    <![endif]--><!--[if gte IE 9]><!-->
    <script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
</head>
<body>
    <div class="new-score">
        <p>谱单名：<input type="text" id="score_name" name="name" ></p>
        <span class="color-red name-alert" style="margin-left: 55px;" hidden>* 请输入谱单名称</span>
        <span></span>
        <input type="hidden" id="sheet_id" name="sheet_id" value="{$sheet_id}">
        <div class="new-score-btn">
            <a href="javascript:;" class="btn btn-create"><span>新建</span></a>
            <a href="javascript:;" class="btn btn-cancle"><span>取消</span></a>
        </div>
    </div>
    <script type="text/javascript" src="__JS__/layer.js"></script>
    <script>
        $('#score-name').on('keyup', function () {
            $('.name-alert').hide();
        });

        $('.btn-create').click(function () {
            var sheet_id = $('#sheet_id').val();
            var name = $('#score_name').val();
            if (name == '') {
                $('.name-alert').show();
            } else {
                var data = {"sheet_id":sheet_id, "name":name};
                console.log(data);
                var url = "{:U('sheet/newScoreAndFav')}";
                $.post(url, data, function (result) {
                    if (result.code == 200) {
                        layer.msg(result.msg, {
                            icon: 1,
                            time: 1500
                        }, function () {
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index); //再执行关闭
                        });
                    } else {
                        layer.msg(result.msg, {
                            icon: 2,
                            time: 1500
                        }, function () {
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index); //再执行关闭
                        });
                    }
                });
            }
        });


        $('.btn-cancle').click(function () {
            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            parent.layer.close(index); //再执行关闭
        })
    </script>
</body>
</html>